```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring Bean 后处理器深度解析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        :root {
            --primary: #3b82f6;
            --primary-dark: #2563eb;
            --secondary: #10b981;
            --dark: #1e293b;
            --light: #f8fafc;
        }
        
        body {
            font-family: 'Noto Sans SC', 'Helvetica Neue', Arial, sans-serif;
            color: #334155;
            line-height: 1.6;
            background-color: #f8fafc;
        }
        
        .hero {
            background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
            color: white;
        }
        
        .code-block {
            background: #1e293b;
            border-left: 4px solid var(--primary);
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        
        .timeline-item::before {
            content: '';
            position: absolute;
            left: -24px;
            top: 0;
            width: 12px;
            height: 12px;
            border-radius: 50%;
            background: var(--primary);
        }
        
        .first-letter {
            float: left;
            font-size: 4.5rem;
            line-height: 1;
            margin-right: 0.5rem;
            margin-top: 0.3rem;
            font-weight: 700;
            color: var(--primary);
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero min-h-[70vh] flex items-center py-20 px-4">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col lg:flex-row items-center gap-12">
                <div class="lg:w-1/2">
                    <h1 class="text-4xl md:text-5xl font-bold mb-6 leading-tight font-serif">
                        Spring Bean 后处理器深度解析
                    </h1>
                    <p class="text-xl text-blue-100 mb-8 max-w-lg">
                        探索Spring框架中强大的BeanPostProcessor接口，掌握Bean生命周期中的关键扩展点。
                    </p>
                    <div class="flex gap-4">
                        <a href="#definition" class="bg-white text-blue-600 px-6 py-3 rounded-lg font-medium hover:bg-blue-50 transition-all">
                            开始阅读
                        </a>
                        <a href="#visualization" class="border-2 border-white text-white px-6 py-3 rounded-lg font-medium hover:bg-white hover:bg-opacity-10 transition-all">
                            查看图解
                        </a>
                    </div>
                </div>
                <div class="lg:w-1/2 hidden lg:block">
                    <div class="bg-white bg-opacity-20 p-8 rounded-xl backdrop-blur-sm">
                        <div class="code-block p-6 rounded-lg">
                            <div class="flex text-gray-400 text-sm mb-4">
                                <div class="w-3 h-3 rounded-full bg-red-500 mr-2"></div>
                                <div class="w-3 h-3 rounded-full bg-yellow-500 mr-2"></div>
                                <div class="w-3 h-3 rounded-full bg-green-500"></div>
                            </div>
                            <pre class="text-gray-300 overflow-x-auto"><code>public interface BeanPostProcessor {
    Object postProcessBeforeInitialization(
        Object bean, String beanName);
    
    Object postProcessAfterInitialization(
        Object bean, String beanName);
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-6xl px-4 py-16">
        <!-- Definition Section -->
        <section id="definition" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">1. Bean 后处理器的定义</h2>
            </div>
            
            <div class="prose max-w-none lg:prose-lg">
                <p><span class="first-letter">B</span>eanPostProcessor 是 Spring 提供的一个核心接口，它允许开发者在 Spring 容器的生命周期中插入自定义逻辑，特别是在 bean 初始化前后进行操作。这个接口提供了一种强大的扩展机制，能够在不修改现有代码的情况下增强Bean的功能。</p>
                
                <div class="code-block my-8 p-6 rounded-lg">
                    <pre class="text-gray-300"><code>public interface BeanPostProcessor {
    Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException;
    Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException;
}</code></pre>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6 my-8">
                    <div class="bg-white p-6 rounded-xl shadow-md border-l-4 border-blue-500">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 rounded-full bg-blue-100 text-blue-600 flex items-center justify-center mr-3">
                                <i class="fas fa-arrow-circle-left text-xl"></i>
                            </div>
                            <h3 class="font-bold text-lg">postProcessBeforeInitialization</h3>
                        </div>
                        <p>在 Bean 初始化之前调用，可以修改或包装原始Bean实例。常用于属性注入前的预处理。</p>
                    </div>
                    
                    <div class="bg-white p-6 rounded-xl shadow-md border-l-4 border-green-500">
                        <div class="flex items-center mb-3">
                            <div class="w-10 h-10 rounded-full bg-green-100 text-green-600 flex items-center justify-center mr-3">
                                <i class="fas fa-arrow-circle-right text-xl"></i>
                            </div>
                            <h3 class="font-bold text-lg">postProcessAfterInitialization</h3>
                        </div>
                        <p>在 Bean 初始化之后调用，可以修改或包装最终的Bean实例。常用于AOP代理的创建。</p>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Registration Section -->
        <section id="registration" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">2. Bean 后处理器的注册</h2>
            </div>
            
            <div class="prose max-w-none lg:prose-lg">
                <p>Spring 容器会自动检测并注册所有实现了 <code>BeanPostProcessor</code> 接口的 Bean，这些后处理器是通过 <code>ApplicationContext</code> 中的 <code>BeanFactory</code> 进行管理的。每个Bean在初始化过程中都会经过这些后处理器的处理。</p>
                
                <div class="code-block my-8 p-6 rounded-lg">
                    <pre class="text-gray-300"><code>@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    // 可以在这里添加处理逻辑
    return bean;  // 返回处理后的bean
}</code></pre>
                </div>
                
                <div class="bg-blue-50 p-6 rounded-lg my-8 border-l-4 border-blue-500">
                    <div class="flex">
                        <div class="mr-4 text-blue-500 text-2xl">
                            <i class="fas fa-info-circle"></i>
                        </div>
                        <div>
                            <h4 class="font-bold text-blue-800 mb-2">关键点</h4>
                            <p class="text-blue-700">Spring 容器会在 Bean 的初始化过程开始之前，首先调用所有注册的 <code>BeanPostProcessor</code> 的 <code>postProcessBeforeInitialization</code> 方法。这使得我们有机会在Bean初始化之前进行预处理。</p>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Timing Section -->
        <section id="timing" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">3. 初始化过程中的调用时机</h2>
            </div>
            
            <div class="prose max-w-none lg:prose-lg">
                <p>Spring 的 <code>AbstractAutowireCapableBeanFactory</code> 是核心的 BeanFactory 实现类，它管理着 Spring 的 Bean 后处理器的调用顺序和时机。</p>
                
                <div class="code-block my-8 p-6 rounded-lg">
                    <pre class="text-gray-300"><code>protected Object createBean(String beanName, RootBeanDefinition mbd, Object[] args) throws BeanCreationException {
    BeanWrapperImpl instanceWrapper = createBeanInstance(beanName, mbd, args);
    // 调用所有BeanPostProcessor的postProcessBeforeInitialization
    Object bean = applyBeanPostProcessorsBeforeInitialization(instanceWrapper.getWrappedInstance(), beanName);
    
    // 初始化Bean
    invokeInitMethods(beanName, mbd, bean);
    
    // 调用所有BeanPostProcessor的postProcessAfterInitialization
    bean = applyBeanPostProcessorsAfterInitialization(bean, beanName);
    return bean;
}</code></pre>
                </div>
                
                <div class="grid lg:grid-cols-3 gap-6 my-10">
                    <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                        <div class="text-blue-500 text-3xl mb-3">
                            <i class="fas fa-cube"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">1. Bean 实例化</h3>
                        <p class="text-gray-600">通过反射创建Bean的原始实例</p>
                    </div>
                    
                    <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                        <div class="text-blue-500 text-3xl mb-3">
                            <i class="fas fa-magic"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">2. Before Initialization</h3>
                        <p class="text-gray-600">调用所有后处理器的postProcessBeforeInitialization方法</p>
                    </div>
                    
                    <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                        <div class="text-blue-500 text-3xl mb-3">
                            <i class="fas fa-rocket"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">3. 初始化方法</h3>
                        <p class="text-gray-600">执行init-method或afterPropertiesSet</p>
                    </div>
                    
                    <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                        <div class="text-blue-500 text-3xl mb-3">
                            <i class="fas fa-wand-magic-sparkles"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">4. After Initialization</h3>
                        <p class="text-gray-600">调用所有后处理器的postProcessAfterInitialization方法</p>
                    </div>
                    
                    <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                        <div class="text-blue-500 text-3xl mb-3">
                            <i class="fas fa-check-circle"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">5. Bean 就绪</h3>
                        <p class="text-gray-600">Bean完全初始化完成，可以使用</p>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Example Section -->
        <section id="example" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">4. 典型的 Bean 后处理器实现</h2>
            </div>
            
            <div class="prose max-w-none lg:prose-lg">
                <p>一个典型的 Bean 后处理器可能是通过代理模式来对某些特定的 Bean 进行增强。比如，你可能会使用 AOP 对某些 Bean 方法进行增强，或者使用自定义的后处理器来做额外的逻辑。</p>
                
                <div class="code-block my-8 p-6 rounded-lg">
                    <pre class="text-gray-300"><code>public class MyBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof MyBean) {
            // 处理某个特定的 Bean
            System.out.println("Before Initialization: " + beanName);
        }
        return bean;  // 返回原始 Bean 或修改后的 Bean
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof MyBean) {
            // 处理某个特定的 Bean
            System.out.println("After Initialization: " + beanName);
        }
        return bean;  // 返回原始 Bean 或修改后的 Bean
    }
}</code></pre>
                </div>
                
                <div class="bg-white p-6 rounded-xl shadow-md my-8">
                    <div class="flex items-start">
                        <div class="bg-yellow-100 text-yellow-800 p-3 rounded-full mr-4">
                            <i class="fas fa-lightbulb text-xl"></i>
                        </div>
                        <div>
                            <h4 class="font-bold text-lg mb-2">实现建议</h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li><strong>目标明确：</strong>通过beanName或类型判断是否需要处理该Bean</li>
                                <li><strong>性能考虑：</strong>不应在处理器中执行耗时操作</li>
                                <li><strong>安全返回：</strong>必须返回可用的Bean实例</li>
                                <li><strong>避免循环：</strong>不要在处理器中创建新的Bean</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Order Section -->
        <section id="order" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">5. Bean 后处理器执行顺序</h2>
            </div>
            
            <div class="prose max-w-none lg:prose-lg">
                <p>Spring 容器在处理 Bean 后处理器时，执行顺序非常重要。如果有多个后处理器，Spring 会按其注册顺序逐个调用它们。</p>
                
                <div class="my-8">
                    <div class="relative">
                        <!-- Timeline -->
                        <div class="border-l-2 border-blue-200 ml-8 pl-8 space-y-12 py-4">
                            <div class="timeline-item relative">
                                <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                                    <div class="flex items-center mb-2">
                                        <div class="bg-blue-100 text-blue-600 p-2 rounded-lg mr-3">
                                            <i class="fas fa-list-ol"></i>
                                        </div>
                                        <h3 class="font-bold">第一步</h3>
                                    </div>
                                    <p>所有 <code>BeanPostProcessor</code> 的 <code>postProcessBeforeInitialization</code> 被调用</p>
                                </div>
                            </div>
                            
                            <div class="timeline-item relative">
                                <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                                    <div class="flex items-center mb-2">
                                        <div class="bg-blue-100 text-blue-600 p-2 rounded-lg mr-3">
                                            <i class="fas fa-play-circle"></i>
                                        </div>
                                        <h3 class="font-bold">第二步</h3>
                                    </div>
                                    <p>Bean 的初始化方法执行（init-method或InitializingBean.afterPropertiesSet）</p>
                                </div>
                            </div>
                            
                            <div class="timeline-item relative">
                                <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                                    <div class="flex items-center mb-2">
                                        <div class="bg-blue-100 text-blue-600 p-2 rounded-lg mr-3">
                                            <i class="fas fa-check-double"></i>
                                        </div>
                                        <h3 class="font-bold">第三步</h3>
                                    </div>
                                    <p>所有 <code>BeanPostProcessor</code> 的 <code>postProcessAfterInitialization</code> 被调用</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Use Cases Section -->
        <section id="use-cases" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">6. 自定义 Bean 后处理器的使用场景</h2>
            </div>
            
            <div class="prose max-w-none lg:prose-lg">
                <p><code>BeanPostProcessor</code> 是Spring框架中极其灵活的扩展点，可以用来实现各种功能增强和系统集成。</p>
                
                <div class="grid md:grid-cols-2 lg:grid-cols-3 gap-6 my-10">
                    <div class="feature-card bg-white p-6 rounded-xl shadow-md border border-gray-100 transition-all duration-300">
                        <div class="text-blue-500 text-4xl mb-4">
                            <i class="fas fa-code-branch"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">动态代理</h3>
                        <p class="text-gray-600">通过 <code>BeanPostProcessor</code> 可以为某些 Bean 创建动态代理，例如 Spring AOP 就是基于此机制实现的。</p>
                    </div>
                    
                    <div class="feature-card bg-white p-6 rounded-xl shadow-md border border-gray-100 transition-all duration-300">
                        <div class="text-green-500 text-4xl mb-4">
                            <i class="fas fa-chart-line"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">性能监控</h3>
                        <p class="text-gray-600">在初始化过程中添加性能监控代码，记录方法执行时间，生成运行时指标。</p>
                    </div>
                    
                    <div class="feature-card bg-white p-6 rounded-xl shadow-md border border-gray-100 transition-all duration-300">
                        <div class="text-purple-500 text-4xl mb-4">
                            <i class="fas fa-cogs"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">自动配置</h3>
                        <p class="text-gray-600">自动为Bean注入依赖或调整配置，实现约定优于配置的开发模式。</p>
                    </div>
                    
                    <div class="feature-card bg-white p-6 rounded-xl shadow-md border border-gray-100 transition-all duration-300">
                        <div class="text-red-500 text-4xl mb-4">
                            <i class="fas fa-shield-alt"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">安全检查</h3>
                        <p class="text-gray-600">验证Bean的配置是否符合安全规范，或在运行时添加安全拦截逻辑。</p>
                    </div>
                    
                    <div class="feature-card bg-white p-6 rounded-xl shadow-md border border-gray-100 transition-all duration-300">
                        <div class="text-yellow-500 text-4xl mb-4">
                            <i class="fas fa-exchange-alt"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">对象转换</h3>
                        <p class="text-gray-600">将原始对象转换为其他形式的对象，如DTO转换、接口代理等。</p>
                    </div>
                    
                    <div class="feature-card bg-white p-6 rounded-xl shadow-md border border-gray-100 transition-all duration-300">
                        <div class="text-indigo-500 text-4xl mb-4">
                            <i class="fas fa-bolt"></i>
                        </div>
                        <h3 class="font-bold text-lg mb-2">懒加载</h3>
                        <p class="text-gray-600">为特定Bean实现懒加载逻辑，优化系统启动性能。</p>
                    </div>
                </div>
                
                <div class="code-block my-8 p-6 rounded-lg">
                    <pre class="text-gray-300"><code>public class LoggingBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("Initializing bean: " + beanName);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("Bean initialized: " + beanName);
        return bean;
    }
}</code></pre>
                </div>
            </div>
        </section>
        
        <!-- AOP Section -->
        <section id="aop" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">7. 处理 Spring AOP 和代理</h2>
            </div>
            
            <div class="prose max-w-none lg:prose-lg">
                <p>Spring AOP 的实现依赖于 <code>BeanPostProcessor</code> 机制，在 <code>postProcessAfterInitialization</code> 阶段创建代理对象。</p>
                
                <div class="bg-indigo-50 p-6 rounded-lg my-8 border-l-4 border-indigo-500">
                    <div class="flex">
                        <div class="mr-4 text-indigo-500 text-2xl">
                            <i class="fas fa-sitemap"></i>
                        </div>
                        <div>
                            <h4 class="font-bold text-indigo-800 mb-2">AOP 代理创建流程</h4>
                            <ol class="list-decimal pl-5 space-y-2 text-indigo-700">
                                <li>容器创建原始Bean实例</li>
                                <li>应用所有后处理器的postProcessBeforeInitialization方法</li>
                                <li>执行初始化回调方法</li>
                                <li>在postProcessAfterInitialization中检查是否需要创建代理</li>
                                <li>如果需要，则使用JDK动态代理或CGLIB创建代理对象</li>
                                <li>将代理对象放入容器而非原始对象</li>
                            </ol>
                        </div>
                    </div>
                </div>
                
                <div class="code-block my-8 p-6 rounded-lg">
                    <pre class="text-gray-300"><code>public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (bean instanceof AopProxy) {
        System.out.println("Bean is AOP-proxied: " + beanName);
    }
    return bean;
}</code></pre>
                </div>
            </div>
        </section>
        
        <!-- Other Processors Section -->
        <section id="other-processors" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">8. 影响 Bean 初始化的其他后处理器</h2>
            </div>
            
            <div class="prose max-w-none lg:prose-lg">
                <p>除了 <code>BeanPostProcessor</code>，Spring 还提供了其他类型的后处理器，可以在不同阶段干预Bean的创建过程。</p>
                
                <div class="grid gap-6 my-8">
                    <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                        <h3 class="font-bold text-lg mb-3 text-blue-600 flex items-center">
                            <i class="fas fa-layer-group mr-2"></i> InstantiationAwareBeanPostProcessor
                        </h3>
                        <p>在 Bean 实例化时更早地插入后处理逻辑，可以在Bean实例化前后进行干预。</p>
                        <div class="code-block my-4 p-4 rounded-lg bg-gray-800">
                            <pre class="text-gray-300 text-sm"><code>public interface InstantiationAwareBeanPostProcessor extends BeanPostProcessor {
    Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName);
    boolean postProcessAfterInstantiation(Object bean, String beanName);
}</code></pre>
                        </div>
                    </div>
                    
                    <div class="bg-white p-6 rounded-xl shadow-sm border border-gray-100">
                        <h3 class="font-bold text-lg mb-3 text-green-600 flex items-center">
                            <i class="fas fa-project-diagram mr-2"></i> BeanFactoryPostProcessor
                        </h3>
                        <p>在 <code>ApplicationContext</code> 初始化后，但在Bean创建之前，可以修改Bean的定义（BeanDefinition）。</p>
                        <div class="code-block my-4 p-4 rounded-lg bg-gray-800">
                            <pre class="text-gray-300 text-sm"><code>public interface BeanFactoryPostProcessor {
    void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory);
}</code></pre>
                        </div>
                    </div>
                </div>
                
                <div class="code-block my-8 p-6 rounded-lg">
                    <pre class="text-gray-300"><code>public class MyInstantiationAwareProcessor implements InstantiationAwareBeanPostProcessor {
    @Override
    public Object postProcessBeforeInstantiation(Class<?> beanClass, String beanName) throws BeansException {
        if (beanClass == MyBean.class) {
            return new MyBean();  // 直接返回新的实例，避免默认的实例化过程
        }
        return null;
    }
}</code></pre>
                </div>
            </div>
        </section>
        
        <!-- Visualization Section -->
        <section id="visualization" class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-1 bg-blue-500 mr-4"></div>
                <h2 class="text-2xl font-bold text-gray-800">Bean 生命周期可视化</h2>
            </div>
            
            <div class="bg-white p-6 rounded-xl shadow-md">
                <div class="mermaid">
                    sequenceDiagram
                        participant Container as Spring容器
                        participant BPP as BeanPostProcessor
                        participant Bean as 目标Bean
                        
                        Container->>Bean: 1. 实例化Bean
                        Container->>BPP: 2. postProcessBeforeInitialization
                        BPP-->>Container: 处理后的Bean
                        Container->>Bean: 3. 调用初始化方法
                        Container->>BPP: 4. postProcessAfterInitialization
                        BPP-->>Container: 最终Bean(可能是代理)
                        Container->>Bean: 5. 放入容器，准备使用
                </div>
                
                <div class="mt-8 grid md:grid-cols-2 gap-8">
                    <div>
                        <h3 class="font-bold text-lg mb-4 flex items-center text-blue-600">
                            <i class="fas fa-diagram-project mr-2"></i> 相关接口关系图
                        </h3>
                        <div class="mermaid">
                            classDiagram
                                class BeanPostProcessor {
                                    <<interface>>
                                    +postProcessBeforeInitialization()
                                    +postProcessAfterInitialization()
                                }
                                
                                class InstantiationAwareBeanPostProcessor {
                                    <<interface>>
                                    +postProcessBeforeInstantiation()
                                    +postProcessAfterInstantiation()
                                }
                                
                                class BeanFactoryPostProcessor {
                                    <<interface>>
                                    +postProcessBeanFactory()
                                }
                                
                                BeanPostProcessor <|-- InstantiationAwareBeanPostProcessor
                        </div>
                    </div>
                    
                    <div>
                        <h3 class="font-bold text-lg mb-4 flex items-center text-green-600">
                            <i class="fas fa-sitemap mr-2"></i> 处理流程决策树
                        </h3>
                        <div class="mermaid">
                            graph TD
                                A[开始创建Bean] --> B{是否有InstantiationAwareBeanPostProcessor?}
                                B -->|是| C[执行postProcessBeforeInstantiation]
                                C --> D{是否返回非null对象?}
                                D -->|是| E[跳过常规实例化流程]
                                D -->|否| F[继续常规实例化]
                                B -->|否| F
                                F --> G[实例化Bean]
                                G --> H[执行postProcessAfterInstantiation]
                                H --> I[执行postProcessBeforeInitialization]
                                I --> J[执行初始化方法]
                                J --> K[执行postProcessAfterInitialization]
                                K --> L[Bean创建完成]
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Summary Section -->
        <section class="mb-20">
            <div class="bg-gradient-to-r from-blue-50 to-indigo-50 p-8 rounded-xl">
                <div class="max-w-3xl mx-auto text-center">
                    <h2 class="text-3xl font-bold text-gray-800 mb-6">掌握 BeanPostProcessor 的强大功能</h2>
                    <p class="text-lg text-gray-600 mb-8">通过灵活运用 <code>BeanPostProcessor</code> 接口，你可以深入干预Spring容器的Bean创建过程，实现各种强大的扩展功能，从AOP代理到自定义初始化逻辑，为你的应用提供无限可能。</p>
                    <div class="flex justify-center gap-4">
                        <a href="#definition" class="bg-blue-600 text-white px-6 py-3 rounded-lg font-medium hover:bg-blue-700 transition-all inline-flex items-center">
                            <i class="fas fa-book-open mr-2"></i> 重新阅读
                        </a>
                        <a href="http://www.yuque.com/jtostring" class="border border-blue-600 text-blue-600 px-6 py-3 rounded-lg font-medium hover:bg-blue-50 transition-all inline-flex items-center">
                            <i class="fas fa-external-link-alt mr-2"></i> 访问技术小馆
                        </a>
                    </div>
                </div>
            </div>
        </section>
    </main>
    
    <!-- Footer -->
    <footer class="bg-gray-900 text-gray-300 py-12">
        <div class="container mx-auto px-4 max-w-6xl">
            <div class="text-center">
                <h3 class="text-xl font-medium text-white mb-2">技术小馆</h3>
                <p class="mb-6">深入技术细节，探索架构之道</p>
                <div class="flex justify-center space-x-4">
                    <a href="http://www.yuque.com/jtostring" class="text-gray-400 hover:text-white transition-colors">
                        <span class="sr-only">语雀</span>
                        <i class="fab fa-yuque text-xl"></i>
                    </a>
                </div>
                <div class="mt-6">
                    <a href="http://www.yuque.com/jtostring" class="text-blue-400 hover:text-blue-300 transition-colors">http://www.yuque.com/jtostring</a>
                </div>
            </div>
            <div class="border-t border-gray-800 mt-8 pt-8 text-center text-sm text-gray-500">
                &copy; 2023 技术小馆. All rights reserved.
            </div>
        </div>
    </footer>
    
    <script>
        // Initialize Mermaid
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            },
            sequence: {
                diagramMarginX: 50,
                diagramMarginY: 10,
                boxTextMargin: 5,
                noteMargin: 10,
                messageMargin: 35,
                mirrorActors: true
            }
        });
        
        // Smooth scrolling for anchor links
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```